home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Graphics Plus
/
Graphics Plus.iso
/
general
/
viewers
/
prev
/
prev.lha
/
gram.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-03-12
|
66KB
|
2,261 lines
extern char *malloc(), *realloc();
# line 6 "gram.y"
#include <stdio.h>
#include <math.h>
#include "art.h"
#include "macro.h"
extern object *objectinit(),
*compinit(),
*csginit(),
*getcsgobj(),
*getcsgexp();
extern symbol *lookup();
extern light *lightinit();
extern attr *astackp;
extern mats *mstackp;
extern object *oblist;
extern light *lights;
extern vector eye, viewup, ref;
extern int lookatdone;
extern matrix trans;
extern float fov;
extern float near;
extern char *title;
extern int maxhitlevel, raysperpix, pixelgrid;
extern long filetype;
extern colour backcol;
extern float fogfactor, rfactor;
extern colour hazecolour;
extern float sourceradius;
extern float falloff;
extern float ri;
extern float twist;
extern float screenx, screeny;
extern int orthographic;
extern float eval_fexpr();
extern int eval_iexpr();
extern expression *get_expr(), *get_varexpr();
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
static int objdefined = FALSE;
extern symbol **ostackp;
# line 65 "gram.y"
typedef union {
object *y_obj;
light *y_lht;
vector *y_pnt;
details *y_det;
char *y_str;
eqn *y_eqn;
term *y_trm;
expression *y_exp;
symbol *y_sym;
csgnode *y_csg;
float y_flt;
int y_int;
} YYSTYPE;
# define CSG 257
# define COMPOSITE 258
# define OBJECT_TYPE 259
# define FLOAT 260
# define INTEGER 261
# define FILETYPE 262
# define OPTION 263
# define NAME 264
# define LBRACE 265
# define RBRACE 266
# define LP 267
# define RP 268
# define RADIUS 269
# define RADII 270
# define COLOUR 271
# define CENTER 272
# define VERTEX 273
# define COMMA 274
# define PCENT 275
# define MATERIAL 276
# define REFI 277
# define MINUS 278
# define AMBIENT 279
# define LIGHT 280
# define INTENSITY 281
# define LOCATION 282
# define DOLS 283
# define EQUATION 284
# define TILE 285
# define OFFFILE 286
# define BASE 287
# define TOP 288
# define CONST 289
# define COEFFS 290
# define ART_SCALE 291
# define ART_ROTATE 292
# define ART_TRANSLATE 293
# define PROJECTION 294
# define ORTHOGRAPHIC 295
# define PERSPECTIVE 296
# define TITLE 297
# define REFLECTANCE 298
# define DOT 299
# define ON 300
# define OFF 301
# define LOOKAT 302
# define FIELDOFVIEW 303
# define TRANSPARENCY 304
# define RAYSPERPIXEL 305
# define BACKGROUND 306
# define SIZE 307
# define MAXHITLEVEL 308
# define OUTPUT 309
# define ORDER 310
# define ABSORPTION 311
# define VREF1 312
# define VREF2 313
# define NUMRAYS 314
# define OBJECT 315
# define TEXTURE 316
# define DIRECTION 317
# define ANGLE 318
# define UP 319
# define TWENTYFIVEBIT 320
# define RANGE 321
# define MAP 322
# define BLENDCOLOR 323
# define SCALEFACTORS 324
# define VORTFILE 325
# define HAZECOLOUR 326
# define FOGFACTOR 327
# define RFACTOR 328
# define FALLOFF 329
# define QUOTE 330
# define REPEAT 331
# define SHADOWS 332
# define COLOURFILE 333
# define VNORMALFILE 334
# define SCALEFACTOR 335
# define SOURCE 336
# define AMPLITUDE 337
# define WAVELENGTH 338
# define PHASE 339
# define TURBULENCE 340
# define SQUEEZE 341
# define DAMPING 342
# define SOURCERADIUS 343
# define NORMAL 344
# define COMPLEXVERTEX 345
# define SCREENSIZE 346
# define MAXTREEDEPTH 347
# define BLEND 348
# define COLOURMAP 349
# define MAPVALUES 350
# define PIXELGRID 351
# define RI 352
# define COLOURBLEND 353
# define NORMALFILE 354
# define BEAMDISTRIBUTION 355
# define INSIDEANGLE 356
# define PLUS 357
# define MULT 358
# define DIV 359
# define POWER 360
# define UMINUS 361
# define EQUALS 362
#define yyclearin yychar = -1
#define yyerrok yyerrflag = 0
extern int yychar;
extern int yyerrflag;
#ifndef YYMAXDEPTH
#define YYMAXDEPTH 150
#endif
YYSTYPE yylval, yyval;
# define YYERRCODE 256
int yyexca[] ={
-1, 1,
0, -1,
-2, 0,
};
# define YYNPROD 154
# define YYLAST 1142
int yyact[]={
107, 415, 95, 332, 411, 129, 218, 232, 129, 62,
68, 69, 70, 71, 72, 73, 74, 130, 131, 318,
160, 161, 82, 83, 159, 85, 86, 158, 301, 417,
187, 182, 63, 64, 414, 96, 66, 264, 230, 129,
101, 102, 103, 87, 129, 109, 110, 111, 112, 77,
67, 123, 124, 117, 118, 119, 120, 121, 122, 410,
153, 193, 125, 129, 196, 108, 202, 374, 133, 409,
78, 79, 76, 75, 262, 256, 100, 195, 361, 129,
99, 136, 137, 126, 128, 130, 131, 128, 130, 131,
319, 98, 97, 81, 400, 408, 146, 80, 148, 149,
150, 151, 65, 338, 368, 129, 205, 154, 32, 197,
403, 339, 201, 200, 129, 367, 388, 229, 128, 130,
131, 292, 227, 128, 130, 131, 129, 203, 93, 183,
184, 185, 186, 402, 91, 188, 189, 129, 89, 192,
94, 93, 128, 130, 131, 92, 91, 249, 397, 362,
199, 198, 129, 223, 92, 307, 226, 239, 128, 130,
131, 145, 129, 233, 234, 235, 236, 90, 89, 317,
318, 240, 241, 242, 243, 244, 245, 143, 247, 248,
37, 35, 36, 251, 128, 130, 131, 141, 88, 94,
90, 253, 254, 128, 130, 131, 173, 257, 258, 259,
260, 261, 246, 263, 238, 128, 130, 131, 132, 297,
171, 168, 172, 174, 176, 396, 128, 130, 131, 129,
281, 282, 283, 284, 175, 179, 286, 316, 288, 177,
178, 128, 130, 131, 37, 35, 36, 170, 169, 319,
302, 128, 130, 131, 216, 387, 127, 116, 391, 209,
173, 115, 129, 309, 383, 129, 312, 313, 129, 217,
114, 113, 61, 314, 171, 168, 172, 174, 176, 380,
386, 84, 389, 129, 333, 385, 140, 105, 175, 179,
129, 323, 321, 177, 178, 129, 328, 273, 330, 142,
272, 170, 169, 144, 334, 335, 336, 337, 128, 130,
131, 298, 147, 373, 341, 342, 343, 129, 237, 351,
379, 352, 353, 194, 139, 129, 356, 5, 317, 318,
129, 3, 209, 269, 2, 278, 363, 364, 365, 1,
366, 128, 130, 131, 128, 130, 131, 128, 130, 131,
302, 371, 300, 270, 299, 6, 345, 306, 375, 376,
377, 378, 128, 130, 131, 381, 382, 299, 104, 128,
130, 131, 157, 0, 128, 130, 131, 0, 370, 384,
390, 0, 0, 392, 393, 394, 0, 0, 160, 161,
0, 395, 159, 269, 398, 158, 128, 130, 131, 372,
0, 0, 401, 129, 128, 130, 131, 404, 405, 128,
130, 131, 369, 406, 407, 0, 129, 30, 29, 28,
0, 412, 413, 58, 31, 211, 416, 4, 207, 40,
41, 52, 38, 42, 0, 0, 53, 167, 180, 54,
27, 224, 0, 215, 43, 60, 48, 47, 46, 45,
44, 37, 35, 36, 16, 355, 0, 7, 55, 129,
0, 0, 20, 8, 56, 11, 21, 0, 22, 23,
39, 57, 276, 0, 354, 0, 59, 0, 129, 19,
18, 340, 128, 130, 131, 129, 12, 13, 14, 24,
0, 34, 26, 49, 50, 128, 130, 131, 329, 129,
250, 278, 129, 15, 331, 129, 9, 10, 360, 0,
0, 17, 25, 0, 51, 274, 275, 271, 319, 0,
0, 58, 273, 0, 228, 272, 0, 40, 41, 52,
38, 42, 0, 206, 53, 33, 0, 54, 128, 130,
131, 0, 43, 60, 48, 47, 46, 45, 44, 37,
35, 36, 0, 324, 0, 0, 55, 128, 130, 131,
0, 0, 56, 129, 128, 130, 131, 327, 39, 57,
0, 129, 326, 0, 59, 0, 129, 0, 128, 130,
131, 128, 130, 131, 128, 130, 131, 214, 213, 212,
0, 49, 50, 58, 0, 0, 266, 317, 318, 40,
41, 52, 38, 42, 0, 0, 53, 0, 0, 54,
0, 0, 51, 0, 43, 60, 48, 47, 46, 45,
44, 37, 35, 36, 0, 325, 0, 0, 55, 129,
0, 160, 161, 156, 56, 159, 0, 0, 158, 291,
39, 57, 128, 130, 131, 0, 59, 0, 0, 230,
128, 130, 131, 0, 0, 128, 130, 131, 0, 214,
213, 212, 0, 49, 50, 58, 0, 0, 208, 0,
0, 40, 41, 52, 38, 42, 210, 0, 53, 0,
0, 54, 0, 231, 51, 0, 43, 60, 48, 47,
46, 45, 44, 37, 35, 36, 267, 0, 0, 0,
55, 0, 0, 0, 0, 0, 56, 0, 128, 130,
131, 0, 39, 57, 0, 0, 58, 0, 59, 265,
0, 0, 40, 41, 52, 38, 42, 0, 229, 53,
0, 0, 54, 0, 0, 49, 50, 43, 60, 48,
47, 46, 45, 44, 37, 35, 36, 0, 315, 210,
268, 55, 129, 0, 289, 290, 51, 56, 311, 0,
0, 310, 129, 39, 57, 129, 0, 58, 308, 59,
204, 0, 129, 40, 41, 52, 38, 42, 0, 0,
53, 305, 0, 54, 0, 129, 49, 50, 43, 60,
48, 47, 46, 45, 44, 37, 35, 36, 0, 304,
0, 0, 55, 129, 0, 303, 0, 51, 56, 129,
268, 0, 296, 0, 39, 57, 129, 295, 0, 0,
59, 129, 294, 0, 0, 293, 129, 0, 0, 129,
287, 128, 130, 131, 129, 285, 0, 49, 50, 129,
0, 128, 130, 131, 128, 130, 131, 0, 0, 0,
255, 128, 130, 131, 129, 252, 0, 0, 51, 129,
0, 0, 0, 225, 128, 130, 131, 129, 222, 0,
0, 221, 129, 0, 220, 129, 0, 219, 129, 0,
0, 129, 128, 130, 131, 0, 0, 191, 128, 130,
131, 129, 0, 0, 190, 128, 130, 131, 129, 165,
128, 130, 131, 129, 0, 128, 130, 131, 128, 130,
131, 0, 164, 128, 130, 131, 129, 163, 128, 130,
131, 129, 162, 0, 0, 155, 129, 0, 152, 129,
0, 0, 129, 128, 130, 131, 0, 138, 128, 130,
131, 129, 0, 0, 0, 135, 128, 130, 131, 129,
0, 128, 130, 131, 128, 130, 131, 128, 130, 131,
128, 130, 131, 134, 0, 0, 0, 129, 0, 320,
128, 130, 131, 322, 0, 0, 0, 128, 130, 131,
0, 181, 128, 130, 131, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 128, 130, 131, 0, 0,
128, 130, 131, 166, 0, 128, 130, 131, 128, 130,
131, 128, 130, 131, 357, 358, 359, 0, 344, 0,
128, 130, 131, 173, 346, 0, 0, 0, 128, 130,
131, 0, 0, 0, 0, 279, 0, 171, 168, 172,
174, 176, 399, 279, 0, 173, 128, 130, 131, 0,
277, 175, 179, 0, 0, 0, 177, 178, 0, 171,
168, 172, 174, 176, 170, 169, 0, 37, 35, 36,
0, 0, 0, 175, 179, 37, 35, 36, 177, 178,
0, 63, 64, 0, 0, 66, 170, 169, 106, 348,
347, 349, 0, 0, 350, 0, 0, 0, 0, 67,
0, 0, 0, 0, 0, 0, 0, 280, 0, 0,
0, 0, 0, 0, 0, 280, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 65 };
int yypact[]={
-1000, 150, -1000, -1000, -1000, -1000, -1000, -2, -228, -228,
-228, -228, -228, -228, -228, -228, -223, -251, -230, -170,
-174, -228, -228, 9, -228, -228, -258, -77, -97, -119,
-124, -360, -1000, -1000, -228, -175, -176, -187, -191, -228,
-228, -228, 811, -218, -228, -228, -228, -228, -3, -4,
-13, -17, -228, -228, -228, -228, -228, -228, -249, -202,
-18, -1000, 217, -1000, -1000, -56, -1000, -228, 679, 217,
217, 661, 217, 217, 217, -1000, -1000, -1000, -1000, -1000,
-228, -228, 653, 217, -1000, 217, 217, -1000, -1000, -1000,
-78, -1000, -88, -1000, -104, -228, 37, -228, -228, -228,
-228, 217, 217, 644, -214, -1000, -228, 641, 118, 638,
217, 217, 217, -1000, -1000, -1000, -1000, 633, 628, 615,
217, 217, 217, -1000, -1000, 728, 706, -276, -228, -228,
-228, -228, -300, -1000, -228, -228, 610, 603, -228, -205,
494, -1000, 392, -1000, -1000, -1000, 217, -1000, 593, 590,
587, 584, -228, 811, 579, -228, -240, -1000, 118, -353,
-1000, -1000, -228, -228, -228, -228, -1000, -1000, -60, -108,
-228, -228, -228, -228, -228, -228, -62, -228, -228, -118,
-1000, -1000, -228, -341, -341, -1000, -1000, -1000, 217, 571,
-228, -228, 566, -1000, -1000, -192, -228, -228, -228, -228,
-228, -193, -228, -264, -1000, -1000, -1000, 443, -1000, -1000,
-1000, -1000, -127, -131, -137, 320, 248, -1000, 774, -228,
-228, -228, -228, 551, -1000, -228, 546, -228, 118, 118,
118, 361, -144, 541, 538, 533, 528, -57, -1000, -228,
217, 217, 521, 515, 497, 217, -1000, 217, 217, -1000,
-111, 484, -228, 477, 474, -228, -228, 217, 217, 217,
217, 217, -228, 464, -1000, -1000, -1000, -39, -1000, -1000,
-1000, -74, 23, -1000, -75, -110, 248, -1000, -1000, -1000,
-228, 275, 341, 288, 283, -228, 214, -228, 211, 118,
118, -357, 13, -228, -228, -228, -228, -1000, -1000, -1000,
-163, -1000, 197, -228, -228, -228, 742, -1000, -228, 217,
-228, -228, 217, 190, 171, -228, -1000, 23, 23, 23,
230, -1000, -188, -116, -1000, -228, -228, -228, 217, -228,
217, -1000, -150, -162, 217, 217, 128, 217, -1000, -228,
-228, 115, 217, 29, -1000, -1000, -200, -228, -228, -228,
-228, 217, 42, -5, -228, -228, -20, -339, -1000, -339,
-1000, -1000, -1000, 7, 2, -23, -152, 11, -1000, -228,
-1000, -26, -228, -228, -228, 217, 217, 217, 217, -1000,
-228, -59, -126, -228, 766, -1000, -1000, -1000, -1000, -172,
217, -228, 217, 217, -141, -164, -228, -228, 217, -1000,
-1000, 217, -228, -228, -173, -199, -215, -270, -1000, -1000,
-228, -228, -234, -273, -1000, -228, -239, -1000 };
int yypgo[]={
0, 0, 514, 362, 686, 244, 415, 343, 358, 277,
276, 523, 106, 6, 289, 347, 346, 342, 28, 329,
324, 321, 317, 314, 313, 293, 308, 301, 259 };
int yyr1[]={
0, 19, 19, 19, 19, 19, 19, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
20, 20, 20, 20, 20, 20, 20, 20, 20, 21,
23, 23, 24, 24, 24, 24, 24, 24, 24, 24,
24, 6, 6, 6, 25, 6, 14, 14, 14, 14,
22, 22, 22, 22, 13, 13, 13, 13, 10, 10,
10, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
11, 11, 11, 11, 11, 11, 11, 11, 11, 8,
8, 9, 9, 12, 12, 12, 26, 26, 26, 27,
27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
27, 17, 17, 18, 15, 15, 16, 16, 16, 16,
16, 5, 5, 5, 5, 7, 28, 7, 7, 4,
4, 4, 4, 4, 4, 2, 2, 2, 2, 2,
2, 3, 3, 3, 3, 1, 1, 1, 1, 1,
1, 1, 1, 1 };
int yyr2[]={
0, 1, 4, 4, 5, 4, 5, 4, 5, 9,
4, 4, 12, 4, 4, 4, 5, 5, 4, 4,
4, 17, 33, 12, 4, 4, 4, 4, 4, 8,
0, 4, 16, 4, 4, 4, 4, 4, 16, 12,
4, 9, 3, 9, 1, 13, 1, 5, 5, 5,
7, 3, 3, 11, 1, 5, 5, 13, 1, 5,
5, 17, 5, 5, 9, 13, 5, 13, 13, 5,
5, 5, 5, 5, 5, 5, 13, 17, 13, 5,
5, 5, 5, 5, 11, 7, 7, 11, 13, 3,
7, 15, 11, 13, 17, 17, 0, 4, 4, 4,
8, 4, 4, 12, 8, 12, 4, 4, 4, 4,
8, 3, 7, 11, 1, 5, 17, 5, 5, 5,
5, 1, 5, 5, 5, 11, 1, 15, 11, 3,
7, 7, 7, 7, 3, 3, 5, 7, 15, 7,
7, 3, 3, 3, 11, 3, 3, 7, 3, 7,
7, 7, 7, 5 };
int yychk[]={
-1000, -19, -20, -21, -6, -22, -7, 297, 303, 346,
347, 305, 326, 327, 328, 343, 294, 351, 320, 319,
302, 306, 308, 309, 329, 352, 332, 280, 259, 258,
257, 264, -12, -11, 331, 292, 293, 291, 272, 310,
269, 270, 273, 284, 290, 289, 288, 287, 286, 333,
334, 354, 271, 276, 279, 298, 304, 311, 263, 316,
285, 264, -1, 260, 261, 330, 264, 278, -1, -1,
-1, -1, -1, -1, -1, 296, 295, 300, 300, 301,
267, 267, -1, -1, 262, -1, -1, 301, 265, 265,
264, 265, 264, 265, 264, 362, -1, 267, 267, 267,
267, -1, -1, -1, -8, -9, 267, -1, 283, -1,
-1, -1, -1, 264, 264, 264, 264, -1, -1, -1,
-1, -1, -1, 300, 301, 264, 285, 264, 357, 278,
358, 359, 264, -1, 274, 274, -1, -1, 274, -23,
-10, 265, -14, 265, -25, 265, -1, 265, -1, -1,
-1, -1, 274, 274, -1, 274, -2, -3, 267, 264,
260, 261, 274, 274, 274, 274, 265, -27, 322, 349,
348, 321, 323, 307, 324, 335, 325, 340, 341, 336,
-27, 265, 307, -1, -1, -1, -1, 330, -1, -1,
274, 274, -1, 266, -24, 282, 269, 314, 356, 355,
318, 317, 271, 332, 266, -12, -11, -10, 266, -12,
-11, -6, 259, 258, 257, -14, -5, -28, -13, 274,
274, 274, 274, -1, -9, 274, -1, 362, -2, 357,
278, -2, 360, -1, -1, -1, -1, -26, 264, 265,
-1, -1, -1, -1, -1, -1, 264, -1, -1, 265,
-26, -1, 274, -1, -1, 274, 267, -1, -1, -1,
-1, -1, 267, -1, 301, 266, 266, -4, -11, -12,
-7, 259, 267, 264, 257, 258, -5, 266, -12, 259,
331, -1, -1, -1, -1, 274, -1, 274, -1, -2,
-2, 268, 265, 274, 274, 274, 274, 266, -27, -12,
-17, -18, -1, 274, 274, 274, -15, 266, 274, -1,
274, 274, -1, -1, -1, 274, 266, 357, 358, 278,
-4, 259, -4, -1, 268, 274, 274, 274, -1, 274,
-1, 283, 360, 261, -1, -1, -1, -1, 266, 274,
274, -1, -1, -1, 266, -16, 272, 338, 337, 339,
342, -1, -1, -1, 274, 274, -1, -4, -4, -4,
268, 266, 265, -1, -1, -1, -1, 265, 266, 274,
-18, -1, 274, 274, 267, -1, -1, -1, -1, 268,
274, -1, -1, 274, -13, 268, 268, 268, 268, 261,
-1, 274, -1, -1, -1, -1, 274, 274, -1, 266,
266, -1, 274, 274, -1, -1, -1, -1, 268, 268,
274, 274, -1, -1, 268, 274, -1, 268 };
int yydef[]={
1, -2, 2, 3, 4, 5, 6, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 42, 0,
0, 0, 51, 52, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 7, 8, 145, 146, 0, 148, 0, 0, 10,
11, 0, 13, 14, 15, 16, 17, 18, 19, 20,
0, 0, 0, 24, 25, 26, 27, 28, 30, 58,
0, 46, 0, 44, 0, 0, 0, 0, 0, 0,
0, 62, 63, 0, 66, 89, 0, 0, 0, 0,
69, 70, 71, 72, 73, 74, 75, 0, 0, 0,
79, 80, 81, 82, 83, 0, 0, 0, 0, 0,
0, 0, 0, 153, 0, 0, 0, 0, 0, 0,
0, 58, 0, 46, 121, 126, 50, 54, 0, 0,
0, 0, 0, 0, 0, 0, 0, 135, 0, 141,
142, 143, 0, 0, 0, 0, 96, 85, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
86, 96, 0, 149, 150, 151, 152, 147, 9, 0,
0, 0, 0, 29, 31, 0, 0, 0, 0, 0,
0, 0, 0, 0, 41, 59, 60, 0, 43, 47,
48, 49, 42, 0, 0, 0, 0, 121, 0, 0,
0, 0, 0, 64, 90, 0, 0, 0, 136, 0,
0, 0, 0, 0, 0, 0, 0, 0, 99, 0,
101, 102, 0, 0, 0, 106, 107, 108, 109, 114,
0, 0, 0, 0, 0, 0, 0, 33, 34, 35,
36, 37, 0, 0, 40, 125, 128, 0, 122, 123,
124, 129, 0, 134, 0, 0, 0, 53, 55, 56,
0, 0, 0, 0, 0, 0, 0, 0, 0, 139,
140, 137, 0, 0, 0, 0, 0, 84, 97, 98,
0, 111, 0, 0, 0, 0, 0, 87, 0, 12,
0, 0, 23, 0, 0, 0, 45, 0, 0, 0,
0, 129, 0, 0, 93, 0, 0, 0, 65, 0,
92, 67, 0, 0, 68, 76, 0, 78, 100, 0,
0, 0, 104, 0, 110, 115, 0, 0, 0, 0,
0, 88, 0, 0, 0, 0, 0, 130, 131, 132,
133, 127, 54, 0, 0, 0, 0, 0, 144, 0,
112, 0, 0, 0, 0, 117, 118, 119, 120, 21,
0, 0, 0, 0, 0, 94, 95, 61, 91, 0,
77, 0, 103, 105, 0, 0, 0, 0, 39, 57,
138, 113, 0, 0, 0, 0, 0, 0, 32, 38,
0, 0, 0, 0, 116, 0, 0, 22 };
typedef struct { char *t_name; int t_val; } yytoktype;
#ifndef YYDEBUG
# define YYDEBUG 0 /* don't allow debugging */
#endif
#if YYDEBUG
yytoktype yytoks[] =
{
"CSG", 257,
"COMPOSITE", 258,
"OBJECT_TYPE", 259,
"FLOAT", 260,
"INTEGER", 261,
"FILETYPE", 262,
"OPTION", 263,
"NAME", 264,
"LBRACE", 265,
"RBRACE", 266,
"LP", 267,
"RP", 268,
"RADIUS", 269,
"RADII", 270,
"COLOUR", 271,
"CENTER", 272,
"VERTEX", 273,
"COMMA", 274,
"PCENT", 275,
"MATERIAL", 276,
"REFI", 277,
"MINUS", 278,
"AMBIENT", 279,
"LIGHT", 280,
"INTENSITY", 281,
"LOCATION", 282,
"DOLS", 283,
"EQUATION", 284,
"TILE", 285,
"OFFFILE", 286,
"BASE", 287,
"TOP", 288,
"CONST", 289,
"COEFFS", 290,
"ART_SCALE", 291,
"ART_ROTATE", 292,
"ART_TRANSLATE", 293,
"PROJECTION", 294,
"ORTHOGRAPHIC", 295,
"PERSPECTIVE", 296,
"TITLE", 297,
"REFLECTANCE", 298,
"DOT", 299,
"ON", 300,
"OFF", 301,
"LOOKAT", 302,
"FIELDOFVIEW", 303,
"TRANSPARENCY", 304,
"RAYSPERPIXEL", 305,
"BACKGROUND", 306,
"SIZE", 307,
"MAXHITLEVEL", 308,
"OUTPUT", 309,
"ORDER", 310,
"ABSORPTION", 311,
"VREF1", 312,
"VREF2", 313,
"NUMRAYS", 314,
"OBJECT", 315,
"TEXTURE", 316,
"DIRECTION", 317,
"ANGLE", 318,
"UP", 319,
"TWENTYFIVEBIT", 320,
"RANGE", 321,
"MAP", 322,
"BLENDCOLOR", 323,
"SCALEFACTORS", 324,
"VORTFILE", 325,
"HAZECOLOUR", 326,
"FOGFACTOR", 327,
"RFACTOR", 328,
"FALLOFF", 329,
"QUOTE", 330,
"REPEAT", 331,
"SHADOWS", 332,
"COLOURFILE", 333,
"VNORMALFILE", 334,
"SCALEFACTOR", 335,
"SOURCE", 336,
"AMPLITUDE", 337,
"WAVELENGTH", 338,
"PHASE", 339,
"TURBULENCE", 340,
"SQUEEZE", 341,
"DAMPING", 342,
"SOURCERADIUS", 343,
"NORMAL", 344,
"COMPLEXVERTEX", 345,
"SCREENSIZE", 346,
"MAXTREEDEPTH", 347,
"BLEND", 348,
"COLOURMAP", 349,
"MAPVALUES", 350,
"PIXELGRID", 351,
"RI", 352,
"COLOURBLEND", 353,
"NORMALFILE", 354,
"BEAMDISTRIBUTION", 355,
"INSIDEANGLE", 356,
"PLUS", 357,
"MULT", 358,
"DIV", 359,
"POWER", 360,
"UMINUS", 361,
"EQUALS", 362,
"-unknown-", -1 /* ends search */
};
char * yyreds[] =
{
"-no such reduction-",
"input : /* empty */",
"input : input hitem",
"input : input light",
"input : input object",
"input : input statement",
"input : input definition",
"hitem : TITLE NAME",
"hitem : FIELDOFVIEW expr",
"hitem : SCREENSIZE expr COMMA expr",
"hitem : MAXTREEDEPTH expr",
"hitem : RAYSPERPIXEL expr",
"hitem : HAZECOLOUR expr COMMA expr COMMA expr",
"hitem : FOGFACTOR expr",
"hitem : RFACTOR expr",
"hitem : SOURCERADIUS expr",
"hitem : PROJECTION PERSPECTIVE",
"hitem : PROJECTION ORTHOGRAPHIC",
"hitem : PIXELGRID ON",
"hitem : TWENTYFIVEBIT ON",
"hitem : TWENTYFIVEBIT OFF",
"hitem : UP LP expr COMMA expr COMMA expr RP",
"hitem : LOOKAT LP expr COMMA expr COMMA expr COMMA expr COMMA expr COMMA expr COMMA expr RP",
"hitem : BACKGROUND expr COMMA expr COMMA expr",
"hitem : MAXHITLEVEL expr",
"hitem : OUTPUT FILETYPE",
"hitem : FALLOFF expr",
"hitem : RI expr",
"hitem : SHADOWS OFF",
"light : LIGHT LBRACE lbody RBRACE",
"lbody : /* empty */",
"lbody : lbody litem",
"litem : LOCATION LP expr COMMA expr COMMA expr RP",
"litem : RADIUS expr",
"litem : NUMRAYS expr",
"litem : INSIDEANGLE expr",
"litem : BEAMDISTRIBUTION expr",
"litem : ANGLE expr",
"litem : DIRECTION LP expr COMMA expr COMMA expr RP",
"litem : COLOUR expr COMMA expr COMMA expr",
"litem : SHADOWS OFF",
"object : OBJECT_TYPE LBRACE body RBRACE",
"object : OBJECT_TYPE",
"object : COMPOSITE LBRACE compbody RBRACE",
"object : CSG LBRACE",
"object : CSG LBRACE csgbody csgexpr RBRACE",
"compbody : /* empty */",
"compbody : compbody transform",
"compbody : compbody bodyitem",
"compbody : compbody object",
"statement : NAME EQUALS expr",
"statement : transform",
"statement : bodyitem",
"statement : REPEAT expr LBRACE stlist RBRACE",
"stlist : /* empty */",
"stlist : stlist transform",
"stlist : stlist OBJECT_TYPE",
"stlist : stlist REPEAT expr LBRACE stlist RBRACE",
"body : /* empty */",
"body : body transform",
"body : body bodyitem",
"bodyitem : CENTER LP expr COMMA expr COMMA expr RP",
"bodyitem : ORDER expr",
"bodyitem : RADIUS expr",
"bodyitem : RADII expr COMMA expr",
"bodyitem : RADII expr COMMA expr COMMA expr",
"bodyitem : VERTEX vbody",
"bodyitem : EQUATION DOLS termlist EQUALS expr DOLS",
"bodyitem : COEFFS expr COMMA expr COMMA expr",
"bodyitem : CONST expr",
"bodyitem : TOP expr",
"bodyitem : BASE expr",
"bodyitem : OFFFILE NAME",
"bodyitem : COLOURFILE NAME",
"bodyitem : VNORMALFILE NAME",
"bodyitem : NORMALFILE NAME",
"bodyitem : COLOUR expr COMMA expr COMMA expr",
"bodyitem : MATERIAL expr COMMA expr COMMA expr COMMA expr",
"bodyitem : AMBIENT expr COMMA expr COMMA expr",
"bodyitem : REFLECTANCE expr",
"bodyitem : TRANSPARENCY expr",
"bodyitem : ABSORPTION expr",
"bodyitem : OPTION ON",
"bodyitem : OPTION OFF",
"bodyitem : TEXTURE NAME LBRACE texture_ops RBRACE",
"bodyitem : TEXTURE NAME textitem",
"bodyitem : TEXTURE TILE textitem",
"bodyitem : TEXTURE TILE LBRACE texture_ops RBRACE",
"bodyitem : TILE NAME SIZE expr COMMA expr",
"vbody : vitem",
"vbody : vbody COMMA vitem",
"vitem : LP expr COMMA expr COMMA expr RP",
"vitem : expr COMMA expr COMMA expr",
"transform : ART_ROTATE LP expr COMMA expr RP",
"transform : ART_TRANSLATE LP expr COMMA expr COMMA expr RP",
"transform : ART_SCALE LP expr COMMA expr COMMA expr RP",
"texture_ops : /* empty */",
"texture_ops : texture_ops textitem",
"texture_ops : texture_ops transform",
"textitem : MAP NAME",
"textitem : COLOURMAP LBRACE mbody RBRACE",
"textitem : BLEND expr",
"textitem : RANGE expr",
"textitem : BLENDCOLOR expr COMMA expr COMMA expr",
"textitem : SIZE expr COMMA expr",
"textitem : SCALEFACTORS expr COMMA expr COMMA expr",
"textitem : SCALEFACTOR expr",
"textitem : VORTFILE NAME",
"textitem : TURBULENCE expr",
"textitem : SQUEEZE expr",
"textitem : SOURCE LBRACE wbody RBRACE",
"mbody : mitem",
"mbody : mbody COMMA mitem",
"mitem : expr COMMA expr COMMA expr",
"wbody : /* empty */",
"wbody : wbody witem",
"witem : CENTER LP expr COMMA expr COMMA expr RP",
"witem : WAVELENGTH expr",
"witem : AMPLITUDE expr",
"witem : PHASE expr",
"witem : DAMPING expr",
"csgbody : /* empty */",
"csgbody : csgbody bodyitem",
"csgbody : csgbody transform",
"csgbody : csgbody definition",
"definition : OBJECT_TYPE NAME LBRACE body RBRACE",
"definition : CSG NAME LBRACE",
"definition : CSG NAME LBRACE csgbody csgexpr RBRACE",
"definition : COMPOSITE NAME LBRACE compbody RBRACE",
"csgexpr : OBJECT_TYPE",
"csgexpr : csgexpr PLUS csgexpr",
"csgexpr : csgexpr MULT csgexpr",
"csgexpr : csgexpr MINUS csgexpr",
"csgexpr : LP csgexpr RP",
"csgexpr : NAME",
"termlist : term",
"termlist : termlist termlist",
"termlist : LP termlist RP",
"termlist : LP termlist RP POWER LBRACE INTEGER RBRACE",
"termlist : termlist PLUS termlist",
"termlist : termlist MINUS termlist",
"term : NAME",
"term : FLOAT",
"term : INTEGER",
"term : NAME POWER LBRACE INTEGER RBRACE",
"expr : FLOAT",
"expr : INTEGER",
"expr : QUOTE NAME QUOTE",
"expr : NAME",
"expr : expr PLUS expr",
"expr : expr MINUS expr",
"expr : expr MULT expr",
"expr : expr DIV expr",
"expr : MINUS expr",
};
#endif /* YYDEBUG */
#line 1 "/usr/lib/yaccpar"
/* @(#)yaccpar 1.10 89/04/04 SMI; from S5R3 1.10 */
/*
** Skeleton parser driver for yacc output
*/
/*
** yacc user known macros and defines
*/
#define YYERROR goto yyerrlab
#define YYACCEPT { free(yys); free(yyv); return(0); }
#define YYABORT { free(yys); free(yyv); return(1); }
#define YYBACKUP( newtoken, newvalue )\
{\
if ( yychar >= 0 || ( yyr2[ yytmp ] >> 1 ) != 1 )\
{\
yyerror( "syntax error - cannot backup" );\
goto yyerrlab;\
}\
yychar = newtoken;\
yystate = *yyps;\
yylval = newvalue;\
goto yynewstate;\
}
#define YYRECOVERING() (!!yyerrflag)
#ifndef YYDEBUG
# define YYDEBUG 1 /* make debugging available */
#endif
/*
** user known globals
*/
int yydebug; /* set to 1 to get debugging */
/*
** driver internal defines
*/
#define YYFLAG (-1000)
/*
** static variables used by the parser
*/
static YYSTYPE *yyv; /* value stack */
static int *yys; /* state stack */
static YYSTYPE *yypv; /* top of value stack */
static int *yyps; /* top of state stack */
static int yystate; /* current state */
static int yytmp; /* extra var (lasts between blocks) */
int yynerrs; /* number of errors */
int yyerrflag; /* error recovery flag */
int yychar; /* current input token number */
/*
** yyparse - return 0 if worked, 1 if syntax error not recovered from
*/
int
yyparse()
{
register YYSTYPE *yypvt; /* top of value stack for $vars */
unsigned yymaxdepth = YYMAXDEPTH;
/*
** Initialize externals - yyparse may be called more than once
*/
yyv = (YYSTYPE*)malloc(yymaxdepth*sizeof(YYSTYPE));
yys = (int*)malloc(yymaxdepth*sizeof(int));
if (!yyv || !yys)
{
yyerror( "out of memory" );
return(1);
}
yypv = &yyv[-1];
yyps = &yys[-1];
yystate = 0;
yytmp = 0;
yynerrs = 0;
yyerrflag = 0;
yychar = -1;
goto yystack;
{
register YYSTYPE *yy_pv; /* top of value stack */
register int *yy_ps; /* top of state stack */
register int yy_state; /* current state */
register int yy_n; /* internal state number info */
/*
** get globals into registers.
** branch to here only if YYBACKUP was called.
*/
yynewstate:
yy_pv = yypv;
yy_ps = yyps;
yy_state = yystate;
goto yy_newstate;
/*
** get globals into registers.
** either we just started, or we just finished a reduction
*/
yystack:
yy_pv = yypv;
yy_ps = yyps;
yy_state = yystate;
/*
** top of for (;;) loop while no reductions done
*/
yy_stack:
/*
** put a state and value onto the stacks
*/
#if YYDEBUG
/*
** if debugging, look up token value in list of value vs.
** name pairs. 0 and negative (-1) are special values.
** Note: linear search is used since time is not a real
** consideration while debugging.
*/
if ( yydebug )
{
register int yy_i;
(void)printf( "State %d, token ", yy_state );
if ( yychar == 0 )
(void)printf( "end-of-file\n" );
else if ( yychar < 0 )
(void)printf( "-none-\n" );
else
{
for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
yy_i++ )
{
if ( yytoks[yy_i].t_val == yychar )
break;
}
(void)printf( "%s\n", yytoks[yy_i].t_name );
}
}
#endif /* YYDEBUG */
if ( ++yy_ps >= &yys[ yymaxdepth ] ) /* room on stack? */
{
/*
** reallocate and recover. Note that pointers
** have to be reset, or bad things will happen
*/
int yyps_index = (yy_ps - yys);
int yypv_index = (yy_pv - yyv);
int yypvt_index = (yypvt - yyv);
yymaxdepth += YYMAXDEPTH;
yyv = (YYSTYPE*)realloc((char*)yyv,
yymaxdepth * sizeof(YYSTYPE));
yys = (int*)realloc((char*)yys,
yymaxdepth * sizeof(int));
if (!yyv || !yys)
{
yyerror( "yacc stack overflow" );
return(1);
}
yy_ps = yys + yyps_index;
yy_pv = yyv + yypv_index;
yypvt = yyv + yypvt_index;
}
*yy_ps = yy_state;
*++yy_pv = yyval;
/*
** we have a new state - find out what to do
*/
yy_newstate:
if ( ( yy_n = yypact[ yy_state ] ) <= YYFLAG )
goto yydefault; /* simple state */
#if YYDEBUG
/*
** if debugging, need to mark whether new token grabbed
*/
yytmp = yychar < 0;
#endif
if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
yychar = 0; /* reached EOF */
#if YYDEBUG
if ( yydebug && yytmp )
{
register int yy_i;
(void)printf( "Received token " );
if ( yychar == 0 )
(void)printf( "end-of-file\n" );
else if ( yychar < 0 )
(void)printf( "-none-\n" );
else
{
for ( yy_i = 0; yytoks[yy_i].t_val >= 0;
yy_i++ )
{
if ( yytoks[yy_i].t_val == yychar )
break;
}
(void)printf( "%s\n", yytoks[yy_i].t_name );
}
}
#endif /* YYDEBUG */
if ( ( ( yy_n += yychar ) < 0 ) || ( yy_n >= YYLAST ) )
goto yydefault;
if ( yychk[ yy_n = yyact[ yy_n ] ] == yychar ) /*valid shift*/
{
yychar = -1;
yyval = yylval;
yy_state = yy_n;
if ( yyerrflag > 0 )
yyerrflag--;
goto yy_stack;
}
yydefault:
if ( ( yy_n = yydef[ yy_state ] ) == -2 )
{
#if YYDEBUG
yytmp = yychar < 0;
#endif
if ( ( yychar < 0 ) && ( ( yychar = yylex() ) < 0 ) )
yychar = 0; /* reached EOF */
#if YYDEBUG
if ( yydebug && yytmp )
{
register int yy_i;
(void)printf( "Received token " );
if ( yychar == 0 )
(void)printf( "end-of-file\n" );
else if ( yychar < 0 )
(void)printf( "-none-\n" );
else
{
for ( yy_i = 0;
yytoks[yy_i].t_val >= 0;
yy_i++ )
{
if ( yytoks[yy_i].t_val
== yychar )
{
break;
}
}
(void)printf( "%s\n", yytoks[yy_i].t_name );
}
}
#endif /* YYDEBUG */
/*
** look through exception table
*/
{
register int *yyxi = yyexca;
while ( ( *yyxi != -1 ) ||
( yyxi[1] != yy_state ) )
{
yyxi += 2;
}
while ( ( *(yyxi += 2) >= 0 ) &&
( *yyxi != yychar ) )
;
if ( ( yy_n = yyxi[1] ) < 0 )
YYACCEPT;
}
}
/*
** check for syntax error
*/
if ( yy_n == 0 ) /* have an error */
{
/* no worry about speed here! */
switch ( yyerrflag )
{
case 0: /* new error */
yyerror( "syntax error" );
goto skip_init;
yyerrlab:
/*
** get globals into registers.
** we have a user generated syntax type error
*/
yy_pv = yypv;
yy_ps = yyps;
yy_state = yystate;
yynerrs++;
skip_init:
case 1:
case 2: /* incompletely recovered error */
/* try again... */
yyerrflag = 3;
/*
** find state where "error" is a legal
** shift action
*/
while ( yy_ps >= yys )
{
yy_n = yypact[ *yy_ps ] + YYERRCODE;
if ( yy_n >= 0 && yy_n < YYLAST &&
yychk[yyact[yy_n]] == YYERRCODE) {
/*
** simulate shift of "error"
*/
yy_state = yyact[ yy_n ];
goto yy_stack;
}
/*
** current state has no shift on
** "error", pop stack
*/
#if YYDEBUG
# define _POP_ "Error recovery pops state %d, uncovers state %d\n"
if ( yydebug )
(void)printf( _POP_, *yy_ps,
yy_ps[-1] );
# undef _POP_
#endif
yy_ps--;
yy_pv--;
}
/*
** there is no state on stack with "error" as
** a valid shift. give up.
*/
YYABORT;
case 3: /* no shift yet; eat a token */
#if YYDEBUG
/*
** if debugging, look up token in list of
** pairs. 0 and negative shouldn't occur,
** but since timing doesn't matter when
** debugging, it doesn't hurt to leave the
** tests here.
*/
if ( yydebug )
{
register int yy_i;
(void)printf( "Error recovery discards " );
if ( yychar == 0 )
(void)printf( "token end-of-file\n" );
else if ( yychar < 0 )
(void)printf( "token -none-\n" );
else
{
for ( yy_i = 0;
yytoks[yy_i].t_val >= 0;
yy_i++ )
{
if ( yytoks[yy_i].t_val
== yychar )
{
break;
}
}
(void)printf( "token %s\n",
yytoks[yy_i].t_name );
}
}
#endif /* YYDEBUG */
if ( yychar == 0 ) /* reached EOF. quit */
YYABORT;
yychar = -1;
goto yy_newstate;
}
}/* end if ( yy_n == 0 ) */
/*
** reduction by production yy_n
** put stack tops, etc. so things right after switch
*/
#if YYDEBUG
/*
** if debugging, print the string that is the user's
** specification of the reduction which is just about
** to be done.
*/
if ( yydebug )
(void)printf( "Reduce by (%d) \"%s\"\n",
yy_n, yyreds[ yy_n ] );
#endif
yytmp = yy_n; /* value to switch over */
yypvt = yy_pv; /* $vars top of value stack */
/*
** Look in goto table for next state
** Sorry about using yy_state here as temporary
** register variable, but why not, if it works...
** If yyr2[ yy_n ] doesn't have the low order bit
** set, then there is no action to be done for
** this reduction. So, no saving & unsaving of
** registers done. The only difference between the
** code just after the if and the body of the if is
** the goto yy_stack in the body. This way the test
** can be made before the choice of what to do is needed.
*/
{
/* length of production doubled with extra bit */
register int yy_len = yyr2[ yy_n ];
if ( !( yy_len & 01 ) )
{
yy_len >>= 1;
yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
*( yy_ps -= yy_len ) + 1;
if ( yy_state >= YYLAST ||
yychk[ yy_state =
yyact[ yy_state ] ] != -yy_n )
{
yy_state = yyact[ yypgo[ yy_n ] ];
}
goto yy_stack;
}
yy_len >>= 1;
yyval = ( yy_pv -= yy_len )[1]; /* $$ = $1 */
yy_state = yypgo[ yy_n = yyr1[ yy_n ] ] +
*( yy_ps -= yy_len ) + 1;
if ( yy_state >= YYLAST ||
yychk[ yy_state = yyact[ yy_state ] ] != -yy_n )
{
yy_state = yyact[ yypgo[ yy_n ] ];
}
}
/* save until reenter driver code */
yystate = yy_state;
yyps = yy_ps;
yypv = yy_pv;
}
/*
** code supplied by user is placed in this switch
*/
switch( yytmp )
{
case 1:
# line 120 "gram.y"
{
objdefined = FALSE;
} break;
case 4:
# line 126 "gram.y"
{
object *obj, *head;
if ((head = objectinit(yypvt[-0].y_det->u.obj.sym, yypvt[-0].y_det->u.obj.det)) != (object *)NULL) {
for (obj = head; obj->nxt != (object *)NULL; obj = obj->nxt)
;
obj->nxt = oblist;
oblist = head;
}
objdefined = TRUE;
free(yypvt[-0].y_det);
} break;
case 6:
# line 143 "gram.y"
{
objdefined = TRUE;
free(yypvt[-0].y_det);
} break;
case 8:
# line 152 "gram.y"
{
float val;
val = eval_fexpr(yypvt[-0].y_exp);
if (val == 0.0 || val == 360.0)
fatal("art: idiotic angle in field of view.\n");
near = 1.0 / tan(M_PI / 360.0 * val);
fov = val;
} break;
case 9:
# line 165 "gram.y"
{
screenx = eval_fexpr(yypvt[-2].y_exp) / 2.0;
screeny = eval_fexpr(yypvt[-0].y_exp) / 2.0;
} break;
case 16:
# line 176 "gram.y"
{
orthographic = FALSE;
} break;
case 17:
# line 180 "gram.y"
{
orthographic = TRUE;
} break;
case 21:
# line 187 "gram.y"
{
viewup.x = eval_fexpr(yypvt[-5].y_exp);
viewup.y = eval_fexpr(yypvt[-3].y_exp);
viewup.z = eval_fexpr(yypvt[-1].y_exp);
} break;
case 22:
# line 194 "gram.y"
{
vector t, u, s;
matrix m, tmp;
double val, vy, vz, sinval, cosval;
twist = -eval_fexpr(yypvt[-1].y_exp);
eye.x = eval_fexpr(yypvt[-13].y_exp);
eye.y = eval_fexpr(yypvt[-11].y_exp);
eye.z = eval_fexpr(yypvt[-9].y_exp);
ref.x = eval_fexpr(yypvt[-7].y_exp);
ref.y = eval_fexpr(yypvt[-5].y_exp);
ref.z = eval_fexpr(yypvt[-3].y_exp);
fprintf(stderr, "eye: %f %f %f\n", eye.x, eye.y, eye.z);
fprintf(stderr, "ref: %f %f %f\n", ref.x, ref.y, ref.z);
fprintf(stderr, "twist: %f\n", twist);
fprintf(stderr, "fov: %f\n", fov);
} break;
case 41:
# line 242 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = OBJECT;
yyval.y_det->u.obj.sym = yypvt[-3].y_sym;
yyval.y_det->u.obj.det = yypvt[-1].y_det;
yyval.y_det->nxt = (details *)NULL;
} break;
case 42:
# line 250 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = OBJECT;
yyval.y_det->u.obj.sym = yypvt[-0].y_sym;
yyval.y_det->u.obj.det = (details *)NULL;
yyval.y_det->nxt = (details *)NULL;
} break;
case 43:
# line 258 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = COMP_OBJ;
yyval.y_det->u.obj.sym = (symbol *)NULL;
yyval.y_det->u.obj.det = yypvt[-1].y_det;
yyval.y_det->nxt = (details *)NULL;
} break;
case 44:
# line 266 "gram.y"
{
ostackp++;
*ostackp = (symbol *)NULL;
} break;
case 45:
# line 271 "gram.y"
{
details *d;
symbol *s;
ostackp--;
d = (details *)smalloc(sizeof(details));
d->type = yypvt[-2].y_det->type;
d->u.csgobj.tree = yypvt[-1].y_csg;
d->u.csgobj.det = yypvt[-2].y_det;
d->nxt = (details *)NULL;
s = (symbol *)smalloc(sizeof(symbol));
s->type = CSG_OBJ;
s->u.det = d;
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = OBJECT;
yyval.y_det->u.obj.sym = s;
yyval.y_det->u.obj.det = (details *)NULL;
yyval.y_det->nxt = (details *)NULL;
} break;
case 46:
# line 296 "gram.y"
{
yyval.y_det = (details *)NULL;
} break;
case 47:
# line 300 "gram.y"
{
yyval.y_det = yypvt[-0].y_det;
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
} break;
case 48:
# line 305 "gram.y"
{
yyval.y_det = yypvt[-0].y_det;
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
} break;
case 49:
# line 310 "gram.y"
{
yyval.y_det = yypvt[-0].y_det;
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
} break;
case 50:
# line 317 "gram.y"
{
defvar(yypvt[-2].y_str, yypvt[-0].y_exp);
} break;
case 51:
# line 321 "gram.y"
{
switch (yypvt[-0].y_det->type) {
case ART_TRANSLATE:
translate(yypvt[-0].y_det->u.v.x, yypvt[-0].y_det->u.v.y, yypvt[-0].y_det->u.v.z);
break;
case ART_SCALE:
scale(yypvt[-0].y_det->u.v.x, yypvt[-0].y_det->u.v.y, yypvt[-0].y_det->u.v.z);
break;
case ART_ROTATE:
rotate(yypvt[-0].y_det->u.rot.ang, yypvt[-0].y_det->u.rot.axis);
break;
default:
fatal("art: bad transform type in switch.\n");
}
free(yypvt[-0].y_det);
} break;
case 52:
# line 339 "gram.y"
{
surface *s;
/*
* don't want to change someone else's
* material properties
*/
if (objdefined) {
s = (surface *)smalloc(sizeof(surface));
*s = *astackp->s;
astackp->s = s;
} else
s = astackp->s;
switch (yypvt[-0].y_det->type) {
case COLOUR:
s->c.r = yypvt[-0].y_det->u.c.r;
s->c.g = yypvt[-0].y_det->u.c.g;
s->c.b = yypvt[-0].y_det->u.c.b;
break;
case AMBIENT:
s->a.r = yypvt[-0].y_det->u.c.r;
s->a.g = yypvt[-0].y_det->u.c.g;
s->a.b = yypvt[-0].y_det->u.c.b;
break;
case TEXTURE:
break;
case MATERIAL:
s->ri = yypvt[-0].y_det->u.mat.ri;
s->kd = yypvt[-0].y_det->u.mat.kd;
s->ks = yypvt[-0].y_det->u.mat.ks;
s->ksexp = yypvt[-0].y_det->u.mat.ksexp;
break;
case REFLECTANCE:
s->refl = yypvt[-0].y_det->u.f;
break;
case TRANSPARENCY:
s->trans = yypvt[-0].y_det->u.f;
break;
case ABSORPTION:
s->falloff = yypvt[-0].y_det->u.f;
break;
case ON:
astackp->options |= yypvt[-0].y_det->u.i;
break;
case OFF:
astackp->options &= ~yypvt[-0].y_det->u.i;
break;
default:
fatal("art: bad statement type in switch.\n");
}
free(yypvt[-0].y_det);
} break;
case 53:
# line 394 "gram.y"
{
dorepeat(yypvt[-3].y_exp, yypvt[-1].y_det);
} break;
case 54:
# line 400 "gram.y"
{
yyval.y_det = (details *)NULL;
} break;
case 55:
# line 404 "gram.y"
{
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
yyval.y_det = yypvt[-0].y_det;
} break;
case 56:
# line 409 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = OBJECT;
yyval.y_det->u.sym = yypvt[-0].y_sym;
yyval.y_det->nxt = yypvt[-1].y_det;
} break;
case 57:
# line 417 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = REPEAT;
yyval.y_det->u.rpt.expr = yypvt[-3].y_exp;
yyval.y_det->u.rpt.stmt = yypvt[-1].y_det;
yyval.y_det->nxt = yypvt[-5].y_det;
} break;
case 58:
# line 429 "gram.y"
{
yyval.y_det = (details *)NULL;
} break;
case 59:
# line 433 "gram.y"
{
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
yyval.y_det = yypvt[-0].y_det;
} break;
case 60:
# line 438 "gram.y"
{
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
yyval.y_det = yypvt[-0].y_det;
} break;
case 61:
# line 445 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = CENTER;
yyval.y_det->u.v.x = eval_fexpr(yypvt[-5].y_exp);
yyval.y_det->u.v.y = eval_fexpr(yypvt[-3].y_exp);
yyval.y_det->u.v.z = eval_fexpr(yypvt[-1].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 62:
# line 454 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = ORDER;
yyval.y_det->u.i = eval_iexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 63:
# line 461 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = RADIUS;
yyval.y_det->u.f = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 64:
# line 468 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = RADII;
yyval.y_det->u.v.x = eval_fexpr(yypvt[-2].y_exp);
yyval.y_det->u.v.y = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 65:
# line 476 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = RADII;
yyval.y_det->u.v.x = eval_fexpr(yypvt[-4].y_exp);
yyval.y_det->u.v.y = eval_fexpr(yypvt[-2].y_exp);
yyval.y_det->u.v.z = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 66:
# line 485 "gram.y"
{
if (yypvt[-0].y_det->nxt == (details *)NULL) {
yypvt[-0].y_det->type = VERTEX;
yyval.y_det = yypvt[-0].y_det;
} else {
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = COMPLEXVERTEX;
yyval.y_det->u.det = yypvt[-0].y_det;
yyval.y_det->nxt = (details *)NULL;
}
} break;
case 67:
# line 497 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = EQUATION;
yyval.y_det->u.t = (term *)smalloc(sizeof(term));
yyval.y_det->u.t->coef = -eval_fexpr(yypvt[-1].y_exp);
yyval.y_det->u.t->xp = 0;
yyval.y_det->u.t->yp = 0;
yyval.y_det->u.t->zp = 0;
yyval.y_det->u.t->nxt = yypvt[-3].y_trm;
yyval.y_det->nxt = (details *)NULL;
} break;
case 68:
# line 509 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = COEFFS;
yyval.y_det->u.v.x = eval_fexpr(yypvt[-4].y_exp);
yyval.y_det->u.v.y = eval_fexpr(yypvt[-2].y_exp);
yyval.y_det->u.v.z = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 69:
# line 518 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = CONST;
yyval.y_det->u.f = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 70:
# line 525 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = TOP;
yyval.y_det->u.f = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 71:
# line 532 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = BASE;
yyval.y_det->u.f = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 72:
# line 539 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = OFFFILE;
yyval.y_det->u.s = yypvt[-0].y_str;
yyval.y_det->nxt = (details *)NULL;
} break;
case 73:
# line 546 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = COLOURFILE;
yyval.y_det->u.s = yypvt[-0].y_str;
yyval.y_det->nxt = (details *)NULL;
} break;
case 74:
# line 553 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = VNORMALFILE;
yyval.y_det->u.s = yypvt[-0].y_str;
yyval.y_det->nxt = (details *)NULL;
} break;
case 75:
# line 560 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = NORMALFILE;
yyval.y_det->u.s = yypvt[-0].y_str;
yyval.y_det->nxt = (details *)NULL;
} break;
case 76:
# line 567 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = COLOUR;
yyval.y_det->u.c.r = eval_fexpr(yypvt[-4].y_exp);
yyval.y_det->u.c.g = eval_fexpr(yypvt[-2].y_exp);
yyval.y_det->u.c.b = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 77:
# line 576 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = MATERIAL;
yyval.y_det->u.mat.ri = eval_fexpr(yypvt[-6].y_exp);
yyval.y_det->u.mat.kd = eval_fexpr(yypvt[-4].y_exp);
yyval.y_det->u.mat.ks = eval_fexpr(yypvt[-2].y_exp);
yyval.y_det->u.mat.ksexp = eval_iexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 78:
# line 586 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = AMBIENT;
yyval.y_det->u.v.x = eval_fexpr(yypvt[-4].y_exp);
yyval.y_det->u.v.y = eval_fexpr(yypvt[-2].y_exp);
yyval.y_det->u.v.z = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 79:
# line 595 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = REFLECTANCE;
yyval.y_det->u.f = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 80:
# line 602 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = TRANSPARENCY;
yyval.y_det->u.f = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 81:
# line 609 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = ABSORPTION;
yyval.y_det->u.f = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 82:
# line 616 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = ON;
yyval.y_det->u.i = yypvt[-1].y_int;
yyval.y_det->nxt = (details *)NULL;
} break;
case 83:
# line 623 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = OFF;
yyval.y_det->u.i = yypvt[-1].y_int;
yyval.y_det->nxt = (details *)NULL;
} break;
case 84:
# line 630 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = TEXTURE;
yyval.y_det->nxt = (details *)NULL;
} break;
case 85:
# line 636 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = TEXTURE;
yyval.y_det->nxt = (details *)NULL;
} break;
case 86:
# line 642 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = TEXTURE;
yyval.y_det->nxt = (details *)NULL;
} break;
case 87:
# line 648 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = TEXTURE;
yyval.y_det->nxt = (details *)NULL;
} break;
case 88:
# line 654 "gram.y"
{
details *d1, *d2;
d1 = (details *)smalloc(sizeof(details));
d1->type = VORTFILE;
d1->u.s = yypvt[-4].y_str;
d2 = (details *)smalloc(sizeof(details));
d2->type = SIZE;
d2->u.v.x = eval_fexpr(yypvt[-2].y_exp);
d2->u.v.y = eval_fexpr(yypvt[-0].y_exp);
d1->nxt = d2;
d2->nxt = (details *)NULL;
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = TEXTURE;
yyval.y_det->nxt = (details *)NULL;
} break;
case 89:
# line 676 "gram.y"
{
yyval.y_det = yypvt[-0].y_det;
} break;
case 90:
# line 680 "gram.y"
{
yypvt[-0].y_det->nxt = yypvt[-2].y_det;
yyval.y_det = yypvt[-0].y_det;
} break;
case 91:
# line 687 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = VERTEX;
yyval.y_det->u.v.x = eval_fexpr(yypvt[-5].y_exp);
yyval.y_det->u.v.y = eval_fexpr(yypvt[-3].y_exp);
yyval.y_det->u.v.z = eval_fexpr(yypvt[-1].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 92:
# line 696 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = COLOUR;
yyval.y_det->u.v.x = eval_fexpr(yypvt[-4].y_exp);
yyval.y_det->u.v.y = eval_fexpr(yypvt[-2].y_exp);
yyval.y_det->u.v.z = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 93:
# line 706 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = ART_ROTATE;
yyval.y_det->u.rot.ang = eval_fexpr(yypvt[-3].y_exp);
yyval.y_det->u.rot.axis = eval_iexpr(yypvt[-1].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 94:
# line 714 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = ART_TRANSLATE;
yyval.y_det->u.v.x = eval_fexpr(yypvt[-5].y_exp);
yyval.y_det->u.v.y = eval_fexpr(yypvt[-3].y_exp);
yyval.y_det->u.v.z = eval_fexpr(yypvt[-1].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 95:
# line 723 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = ART_SCALE;
yyval.y_det->u.v.x = eval_fexpr(yypvt[-5].y_exp);
yyval.y_det->u.v.y = eval_fexpr(yypvt[-3].y_exp);
yyval.y_det->u.v.z = eval_fexpr(yypvt[-1].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 111:
# line 753 "gram.y"
{
yyval.y_det = (details *)NULL;
} break;
case 112:
# line 757 "gram.y"
{
yypvt[-0].y_det->nxt = yypvt[-2].y_det;
yyval.y_det = yypvt[-0].y_det;
} break;
case 113:
# line 764 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = MAPVALUES;
yyval.y_det->u.v.x = eval_fexpr(yypvt[-4].y_exp);
yyval.y_det->u.v.y = eval_fexpr(yypvt[-2].y_exp);
yyval.y_det->u.v.z = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 114:
# line 774 "gram.y"
{
yyval.y_det = (details *)NULL;
} break;
case 115:
# line 778 "gram.y"
{
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
yyval.y_det = yypvt[-0].y_det;
} break;
case 116:
# line 785 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = CENTER;
yyval.y_det->u.v.x = eval_fexpr(yypvt[-5].y_exp);
yyval.y_det->u.v.y = eval_fexpr(yypvt[-3].y_exp);
yyval.y_det->u.v.z = eval_fexpr(yypvt[-1].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 117:
# line 794 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = WAVELENGTH;
yyval.y_det->u.f = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 118:
# line 801 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = AMPLITUDE;
yyval.y_det->u.f = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 119:
# line 808 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = PHASE;
yyval.y_det->u.f = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 120:
# line 815 "gram.y"
{
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = DAMPING;
yyval.y_det->u.f = eval_fexpr(yypvt[-0].y_exp);
yyval.y_det->nxt = (details *)NULL;
} break;
case 121:
# line 825 "gram.y"
{
yyval.y_det = (details *)NULL;
} break;
case 122:
# line 829 "gram.y"
{
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
yyval.y_det = yypvt[-0].y_det;
} break;
case 123:
# line 834 "gram.y"
{
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
yyval.y_det = yypvt[-0].y_det;
} break;
case 124:
# line 839 "gram.y"
{
yypvt[-0].y_det->nxt = yypvt[-1].y_det;
yyval.y_det = yypvt[-0].y_det;
} break;
case 125:
# line 846 "gram.y"
{
defobj(yypvt[-3].y_str, yypvt[-4].y_sym->type, yypvt[-1].y_det);
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = OBJECT;
yyval.y_det->u.sym = lookup(yypvt[-3].y_str);
yyval.y_det->nxt = (details *)NULL;
} break;
case 126:
# line 856 "gram.y"
{
ostackp++;
*ostackp = (symbol *)NULL;
} break;
case 127:
# line 861 "gram.y"
{
details *d;
ostackp--;
d = (details *)smalloc(sizeof(details));
d->type = yypvt[-1].y_csg->type;
d->u.csgobj.tree = yypvt[-1].y_csg;
d->u.csgobj.det = yypvt[-2].y_det;
d->nxt = (details *)NULL;
defobj(yypvt[-5].y_str, CSG_OBJ, d);
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = OBJECT;
yyval.y_det->u.sym = lookup(yypvt[-5].y_str);
yyval.y_det->nxt = (details *)NULL;
} break;
case 128:
# line 882 "gram.y"
{
defobj(yypvt[-3].y_str, COMP_OBJ, yypvt[-1].y_det);
yyval.y_det = (details *)smalloc(sizeof(details));
yyval.y_det->type = OBJECT;
yyval.y_det->u.sym = lookup(yypvt[-3].y_str);
yyval.y_det->nxt = (details *)NULL;
} break;
case 129:
# line 895 "gram.y"
{
yyval.y_csg = (csgnode *)smalloc(sizeof(csgnode));
yyval.y_csg->type = OBJECT;
yyval.y_csg->u.sym = yypvt[-0].y_sym;
} break;
case 130:
# line 901 "gram.y"
{
yyval.y_csg = (csgnode *)smalloc(sizeof(csgnode));
yyval.y_csg->type = CSG_ADD;
yyval.y_csg->u.branch.left = yypvt[-2].y_csg;
yyval.y_csg->u.branch.right = yypvt[-0].y_csg;
} break;
case 131:
# line 908 "gram.y"
{
yyval.y_csg = (csgnode *)smalloc(sizeof(csgnode));
yyval.y_csg->type = CSG_INT;
yyval.y_csg->u.branch.left = yypvt[-2].y_csg;
yyval.y_csg->u.branch.right = yypvt[-0].y_csg;
} break;
case 132:
# line 915 "gram.y"
{
yyval.y_csg = (csgnode *)smalloc(sizeof(csgnode));
yyval.y_csg->type = CSG_SUB;
yyval.y_csg->u.branch.left = yypvt[-2].y_csg;
yyval.y_csg->u.branch.right = yypvt[-0].y_csg;
} break;
case 133:
# line 922 "gram.y"
{
yyval.y_csg = yypvt[-1].y_csg;
} break;
case 134:
# line 926 "gram.y"
{
char buf[BUFSIZ];
sprintf(buf, "art: object %s not defined.\n", yypvt[-0].y_str);
fatal(buf);
} break;
case 135:
# line 935 "gram.y"
{
yyval.y_trm = yypvt[-0].y_trm;
} break;
case 136:
# line 939 "gram.y"
{
term *t, *p, *np, *prod;
prod = (term *)NULL;
for (p = yypvt[-1].y_trm; p != (term *)NULL; p = p->nxt) {
for (np = yypvt[-0].y_trm; np != (term *)NULL; np = np->nxt) {
t = (term *)smalloc(sizeof(term));
*t = *np;
t->coef *= p->coef;
t->xp += p->xp;
t->yp += p->yp;
t->zp += p->zp;
t->nxt = prod;
prod = t;
}
}
for (t = yypvt[-1].y_trm; t != (term *)NULL; t = np) {
np = t->nxt;
free(t);
}
for (t = yypvt[-0].y_trm; t != (term *)NULL; t = np) {
np = t->nxt;
free(t);
}
yyval.y_trm = prod;
} break;
case 137:
# line 969 "gram.y"
{
yyval.y_trm = yypvt[-1].y_trm;
} break;
case 138:
# line 973 "gram.y"
{
term *t, *p, *np, *prod, *nprod;
int i;
prod = yypvt[-5].y_trm;
for (i = 1; i != yypvt[-1].y_int; i++) {
nprod = (term *)NULL;
for (p = yypvt[-5].y_trm; p != (term *)NULL; p = p->nxt) {
for (np = prod; np != (term *)NULL; np = np->nxt) {
t = (term *)smalloc(sizeof(term));
*t = *np;
t->coef *= p->coef;
t->xp += p->xp;
t->yp += p->yp;
t->zp += p->zp;
t->nxt = nprod;
nprod = t;
}
}
if (prod != yypvt[-5].y_trm)
for (t = prod; t != (term *)NULL; t = np) {
np = t->nxt;
free(t);
}
prod = nprod;
}
for (t = yypvt[-5].y_trm; t != (term *)NULL; t = np) {
np = t->nxt;
free(t);
}
yyval.y_trm = prod;
} break;
case 139:
# line 1009 "gram.y"
{
term *p;
for (p = yypvt[-0].y_trm; p->nxt != (term *)NULL; p = p->nxt)
;
yyval.y_trm = yypvt[-0].y_trm;
p->nxt = yypvt[-2].y_trm;
} break;
case 140:
# line 1018 "gram.y"
{
term *p, *lp;
for (p = yypvt[-0].y_trm; p != (term *)NULL; p = p->nxt) {
p->coef *= -1.0;
lp = p;
}
yyval.y_trm = yypvt[-0].y_trm;
lp->nxt = yypvt[-2].y_trm;
} break;
case 141:
# line 1032 "gram.y"
{
char *p;
yyval.y_trm = (term *)smalloc(sizeof(term));
yyval.y_trm->coef = 1;
yyval.y_trm->xp = 0;
yyval.y_trm->yp = 0;
yyval.y_trm->zp = 0;
yyval.y_trm->nxt = (term *)NULL;
for (p = yypvt[-0].y_str; *p != 0; p++)
switch (*p) {
case 'x':
yyval.y_trm->xp += 1;
break;
case 'y':
yyval.y_trm->yp += 1;
break;
case 'z':
yyval.y_trm->zp += 1;
break;
default:
fatal("art: illegal name in equation.\n");
}
} break;
case 142:
# line 1058 "gram.y"
{
yyval.y_trm = (term *)smalloc(sizeof(term));
yyval.y_trm->coef = yypvt[-0].y_flt;
yyval.y_trm->xp = 0;
yyval.y_trm->yp = 0;
yyval.y_trm->zp = 0;
yyval.y_trm->nxt = (term *)NULL;
} break;
case 143:
# line 1067 "gram.y"
{
yyval.y_trm = (term *)smalloc(sizeof(term));
yyval.y_trm->coef = yypvt[-0].y_int;
yyval.y_trm->xp = 0;
yyval.y_trm->yp = 0;
yyval.y_trm->zp = 0;
yyval.y_trm->nxt = (term *)NULL;
} break;
case 144:
# line 1076 "gram.y"
{
char *p;
yyval.y_trm = (term *)smalloc(sizeof(term));
yyval.y_trm->coef = 1;
yyval.y_trm->xp = 0;
yyval.y_trm->yp = 0;
yyval.y_trm->zp = 0;
yyval.y_trm->nxt = (term *)NULL;
for (p = yypvt[-4].y_str; *p != 0; p++)
switch (*p) {
case 'x':
yyval.y_trm->xp += 1;
break;
case 'y':
yyval.y_trm->yp += 1;
break;
case 'z':
yyval.y_trm->zp += 1;
break;
default:
fatal("art: illegal name in equation.\n");
}
p--;
switch (*p) {
case 'x':
yyval.y_trm->xp += yypvt[-1].y_int - 1;
break;
case 'y':
yyval.y_trm->yp += yypvt[-1].y_int - 1;
break;
case 'z':
yyval.y_trm->zp += yypvt[-1].y_int - 1;
break;
default:
fatal("art: illegal name in equation.\n");
}
} break;
case 145:
# line 1120 "gram.y"
{
yyval.y_exp = (expression *)smalloc(sizeof(expression));
yyval.y_exp->type = EXP_FLOAT;
yyval.y_exp->u.f = yypvt[-0].y_flt;
} break;
case 146:
# line 1126 "gram.y"
{
yyval.y_exp = (expression *)smalloc(sizeof(expression));
yyval.y_exp->type = EXP_INT;
yyval.y_exp->u.i = yypvt[-0].y_int;
} break;
case 147:
# line 1132 "gram.y"
{
yyval.y_exp = (expression *)smalloc(sizeof(expression));
yyval.y_exp->type = EXP_INT;
yyval.y_exp->u.i = *yypvt[-1].y_str;
free(yypvt[-1].y_str);
} break;
case 148:
# line 1139 "gram.y"
{
yyval.y_exp = get_varexpr(yypvt[-0].y_str);
} break;
case 149:
# line 1143 "gram.y"
{
yyval.y_exp = get_expr(EXP_ADD, yypvt[-2].y_exp, yypvt[-0].y_exp);
} break;
case 150:
# line 1147 "gram.y"
{
yyval.y_exp = get_expr(EXP_SUB, yypvt[-2].y_exp, yypvt[-0].y_exp);
} break;
case 151:
# line 1151 "gram.y"
{
yyval.y_exp = get_expr(EXP_MUL, yypvt[-2].y_exp, yypvt[-0].y_exp);
} break;
case 152:
# line 1155 "gram.y"
{
yyval.y_exp = get_expr(EXP_DIV, yypvt[-2].y_exp, yypvt[-0].y_exp);
} break;
case 153:
# line 1159 "gram.y"
{
yyval.y_exp = get_expr(EXP_UMINUS, yypvt[-0].y_exp, (expression *)NULL);
} break;
}
goto yystack; /* reset registers in driver code */
}